static-delta: Initialize read_source_fd to -1
authorAlexander Larsson <alexl@redhat.com>
Fri, 15 Apr 2016 08:01:42 +0000 (10:01 +0200)
committerColin Walters (automation) <walters+githubbot@verbum.org>
Fri, 15 Apr 2016 11:56:06 +0000 (11:56 +0000)
If not, we'll get ESPIPE when seeking on fd 0.

Closes: #260
Approved by: cgwalters

src/libostree/ostree-repo-static-delta-processing.c

index 6c5dd463291c8009514f7a670c8083c6a2d6756c..681d426f4a7f53ae1fcd86be3b80c03f2b81e0d6 100644 (file)
@@ -106,6 +106,12 @@ OPPROTO(close)
 OPPROTO(bspatch)
 #undef OPPROTO
 
+static void
+static_delta_execution_state_init (StaticDeltaExecutionState  *state)
+{
+  state->read_source_fd = -1;
+}
+
 static gboolean
 read_varuint64 (StaticDeltaExecutionState  *state,
                 guint64                    *out_value,
@@ -195,6 +201,8 @@ _ostree_static_delta_part_execute (OstreeRepo      *repo,
   StaticDeltaExecutionState *state = &statedata;
   guint n_executed = 0;
 
+  static_delta_execution_state_init (&statedata);
+
   state->repo = repo;
   state->async_error = error;
   state->trusted = trusted;